***JOP Kane, Mason, and Wronski****
***Supplemental Appendix Figures and Tables -- Qualtrics Survey data***
use "JOP_KMW_Qualtrics.dta" file

*********************TABLE A1. List of Party Coalition Groups and Respective Factor Loadings************
***************************************
*Obtain Factor Loadings and Generate Factor Scores
***************************************

	*Democratic Groups
factor poorwelf_eval unionworkers_eval gays_eval feminists_eval blacks_eval muslims_eval jews_eval secularatheists_eval antigunpeople_eval ///
antiwar_eval hispanics_eval asians_eval environmentalists_eval, fa(1) 
predict DemGroups_pfscore
	*Republican groups
factor businesspeople_eval antiimmigrant_eval gunowners_eval promilitarypeople_eval evangelicals_eval mormons_evals, fa(1)
predict GOPgroups_pfscore

tabstat DemGroups_pfscore GOPgroups_pfscore, st(min max mean iqr) // Obtain descriptives for factor scores, including IQR



*********************TABLE B1. Sample Characteristics************
***descriptive for N=1002 sample
sum inc_fixed, d
sum age, d
tab female
tab white
tab black
tab hispanic
tab pid
tab ideo
sum polint, d


*********************FIGURE C1. Distributions of Closeness Toward Party Coalitions************
	*Democratic Coalition
hist DemGroups_pfscore, percent norm ///
scheme(plotplain) xtitle({bf:Democratic Coalition Score}) ytitle({it: Percent})
	
	*Republican Coalition
hist GOPgroups_pfscore, percent norm ///
scheme(plotplain) xtitle({bf:Republican Coalition Score}) ytitle({it: Percent})


*********************TABLE D1. Regression Model Output for Figures 2 & 3************
**Figure 2 Model
reg pid DemGroups_pfscore GOPgroups_pfscore   ///
PlaceDemGroupsCorrect2_01 PlaceRepGroupsCorrect2_01 ///
polint01 c.age01 edu01 inc01 female  ///
black hispanic other_race /// white= baseline
catholic mormon jewish other_rel no_rel_or_refuse religiosity01, robust // protestant= baseline
	
**Figure 3 Model
reg pid DemGroups_pfscore GOPgroups_pfscore   ///
PlaceDemGroupsCorrect2_01 PlaceRepGroupsCorrect2_01 ///
c.DemGroups_pfscore#c.PlaceDemGroupsCorrect2_01 c.GOPgroups_pfscore#c.PlaceRepGroupsCorrect2_01 /// interaction term
polint01 c.age01 edu01 inc01 female  ///
black hispanic other_race /// white= baseline
catholic mormon jewish other_rel no_rel_or_refuse religiosity01, robust // protestant= baseline
	
	
*****************FIGURE D1.  Alternative Figure 2 with Additive Scales for Coalition Scores************	
reg pid Evals_DEM_groups201 Evals_GOP_groups201   ///
PlaceDemGroupsCorrect2_01 PlaceRepGroupsCorrect2_01 ///
polint01 c.age01##c.age01 edu01 inc01 female  ///
black hispanic other_race /// white= baseline
catholic mormon jewish other_rel no_rel_or_refuse religiosity01, robust // protestant= baseline
coefplot, drop(_cons) ci(95) xline(0) byopts(xrescale) scheme(plottig) nolab


***************TABLE D2.  Group Sentiments and Partisanship Strength (by Party)***********	

	*EFFECTS FOR DEMOCRATS 
ologit PID_strength DemGroups_pfscore GOPgroups_pfscore   ///
PlaceDemGroupsCorrect2_01 PlaceRepGroupsCorrect2_01 ///
polint01 c.age01 edu01 inc01 female  ///
black hispanic other_race /// white= baseline
catholic mormon jewish other_rel no_rel_or_refuse religiosity01 if pid<=3, robust 

margins, at(DemGroups_pfscore=(-1 1)) // being a leaner drops by .1006003 percentage points; being strong increases by .0863702 percentage points
margins, at(GOPgroups_pfscore=(-1 1)) // being a leaner increased by .0842947 pps; being a strong decreased by .0754401 pps


	*EFFECTS FOR REPUBLICANS 
ologit PID_strength DemGroups_pfscore GOPgroups_pfscore   ///
PlaceDemGroupsCorrect2_01 PlaceRepGroupsCorrect2_01 ///
polint01 c.age01 edu01 inc01 female  ///
black hispanic other_race /// white= baseline
catholic mormon jewish other_rel no_rel_or_refuse religiosity01 if pid>=5, robust 

margins, at(DemGroups_pfscore=(-1 1)) // being a leaner increases by .2355865 percentage points; being strong decreases by .1758984 percentage points
margins, at(GOPgroups_pfscore=(-1 1)) // being a leaner decreases by .2337462 percentage points; being strong increases by .1694021 percentage points

***************FIGURE D3:  Sentiments Toward Party Coalitions & Party Identification (w/ Ideology)***********
reg pid DemGroups_pfscore GOPgroups_pfscore   ///
PlaceDemGroupsCorrect2_01 PlaceRepGroupsCorrect2_01 ///
ideo /// ideology
polint01 c.age01 edu01 inc01 female  ///
black hispanic other_race /// white= baseline
catholic mormon jewish other_rel no_rel_or_refuse religiosity01, robust // protestant= baseline


coefplot, drop(_cons) ci(95) xline(0) scheme(plottig) xlabel(-2(.5)2)  ///
coeflabels (DemGroups_pfscore = "{bf: Democratic Coalition Score}" GOPgroups_pfscore = "{bf: Republican Coalition Score}" ///
PlaceDemGroupsCorrect2_01 = "Perceptual Accuracy (Dem Groups)" PlaceRepGroupsCorrect2_01 = "Perceptual Accuracy (Rep Groups)" ///
ideo = "Ideology" ///
polint01= "Political Interest" age01 = "Age" edu01 = "Education" inc01 = "Income" female = "Female" ///
black = "African-American" hispanic = "Hispanic" other_race = "Other Racial Identification" ///
catholic = "Catholic" mormon = "Mormon" jewish = "Jewish" other_rel= "Other Religious Identification" no_rel_or_refuse="No Religion / No Answer" ///
religiosity01= "Religiosity") 

***************FIGURE D4:  Sentiments Toward Party Coalitions, Perceptual Accuracy, and Party ID (w/ Ideology)***********
	*Effects for Affect toward Dem Groups at different levels of Democratic perceptual accuracy
reg pid DemGroups_pfscore GOPgroups_pfscore   ///
PlaceDemGroupsCorrect2_01 PlaceRepGroupsCorrect2_01 ///
c.DemGroups_pfscore#c.PlaceDemGroupsCorrect2_01 c.GOPgroups_pfscore#c.PlaceRepGroupsCorrect2_01 /// interaction term
ideo01 /// ideology
polint01 c.age01 edu01 inc01 female  ///
black hispanic other_race /// white= baseline
catholic mormon jewish other_rel no_rel_or_refuse religiosity01, robust // protestant= baseline
margins, dydx(DemGroups_pfscore) at(PlaceDemGroupsCorrect2_01=(0(.2)1)) 

marginsplot, level(95) recastci(rarea) ciopts(fcolor(gs2%35) fintensity(55) lcolor(gs8%75) lpattern(dash)) ///
plotopts(msymbol(T) mcolor(black)) ///
scheme(plotplain)  yline(0) ///
addplot(hist PlaceDemGroupsCorrect2_01,  title( " ") ylabel(-1(.5)1) ytitle("{bf: Conditional Effect of Democratic-Groups Sentiments on PID}", size(small)) ///
xtitle("{bf: Perceptual Accuracy (Democratic Groups)}", size(medsmall)) ///
yaxis(2) yscale(alt axis(2)) percent ///
ylabel(0 "0%" 2.5 "2.5%" 5 "5%" 7.5 "7.5%" 10 "10%" 12.5 "12.5%" 15 "15%" 17.5 "17.5%" 20 "20%", labcolor(black*.9) axis(2)) ///
ytitle("{it: Percent of Sample}", axis(2) orientation(rvertical))  fcolor(white%10) lcolor(black*.5)) ///
legend(off) ///
xsize(6.5) ysize(4.5) graphregion(margin(vsmall)) ///
name(g1a,replace)

margins, dydx(GOPgroups_pfscore) at (rep_perceptual01=(0(.2)1))

	*Effects for Affect toward Rep Groups at different levels of Republican perceptual accuracy
reg pid DemGroups_pfscore GOPgroups_pfscore   ///
PlaceDemGroupsCorrect2_01 PlaceRepGroupsCorrect2_01 ///
c.DemGroups_pfscore#c.PlaceDemGroupsCorrect2_01 c.GOPgroups_pfscore#c.PlaceRepGroupsCorrect2_01 /// interaction term
ideo01 /// ideology
polint01 c.age01 edu01 inc01 female  ///
black hispanic other_race /// white= baseline
catholic mormon jewish other_rel no_rel_or_refuse religiosity01, robust // protestant= baseline
margins, dydx(GOPgroups_pfscore) at(PlaceRepGroupsCorrect2_01=(0(.2)1)) 

marginsplot, level(95) recastci(rarea) ciopts(fcolor(gs2%35) fintensity(55) lcolor(gs8%75) lpattern(dash)) ///
plotopts(msymbol(T) mcolor(black)) ///
scheme(plotplain) yline(0) ///
addplot(hist PlaceRepGroupsCorrect2_01,  title( " ") ylabel(-1(.5)1) ytitle("{bf: Conditional Effect of Republican-Groups Sentiments on PID}", size(small)) ///
xtitle("{bf: Perceptual Accuracy (Republican Groups)}", size(medsmall)) ///
yaxis(2) yscale(alt axis(2)) percent ///
ylabel(0 "0%" 2.5 "2.5%" 5 "5%" 7.5 "7.5%" 10 "10%" 12.5 "12.5%" 15 "15%" 17.5 "17.5%" 20 "20%", labcolor(black*.9) axis(2)) ///
ytitle("{it: Percent of Sample}", axis(2) orientation(rvertical))  fcolor(white%10) lcolor(black*.5)) ///
legend(off) ///
xsize(6.5) ysize(4.5) graphregion(margin(vsmall)) ///
name(g2b,replace)

graph combine g1a g2b, ycommon iscale(.6) graphregion(margin(tiny)) scheme(plotplain)
